import requestPlat from '@/common/requestPlat'
import request from '@/common/request'
import Qs from 'qs';
import  util from "@/common/util.js"
// 获取宠物性别(枚举)
export let getEnumList = (params) => {
	return requestPlat({
		method: 'get',
		url: `cargo/data/util/enum/list`,
		params,
	})
}
// 获取宠物类型(字典)
export let getValues = (params) => {
	return request({
		method: 'get',
		url: `system/data/util/dict/values`,
		params,
	})
}

// 获取宠物类型 和品种，级联
export let getTypeTree = (params) => {
	return requestPlat({
		method: 'get',
		url: `cargo/data/type/tree`,
		params,
	})
}
// 获取宠物类型 和品种，级联
export let getTypeList = (params) => {
	return requestPlat({
		method: 'get',
		url: `cargo/data/type/list`,
		params,
	})
}





// 获取宠物详情
export let getCargoDetail = (params) => {
	return requestPlat({
		method: 'get',
		url: `cargo/user/cargo/detail`,
		params,
	})
}


// 添加宠物
export let addCargo = (data) => {
	return requestPlat({
		method: 'post',
		url: `cargo/user/cargo/add`,
		data:util.fuseTeamData(data),
		headers: {
			"Content-Type": 'application/json'
		},
		loadData: true
	})
}

// 编辑宠物
export let editCargo = (data) => {
	return requestPlat({
		method: 'post',
		url: `cargo/user/cargo/edit`,
		data,
		headers: {
			"Content-Type": 'application/json'
		},
		loadData: true
	})
}


// 解绑宠物
export let unbindCargo = (data) => {
	return requestPlat({
		method: 'post',
		url: `cargo/user/cargo/unbind`,
		data:Qs.stringify(data),
		loadData: true
	})
}



// 获取宠物列表
export let getCargoPage = (params) => {
	return requestPlat({
		method: 'get',
		url: `cargo/user/cargo/page/${params.page}/${params.limit}`,
		params,
	})
}
// 操作宠物
export let opCargo = (params) => {
	return requestPlat({
		method: 'post',
		url: `cargo/user/cargo/op`,
		params
	})
}
